home *** CD-ROM | disk | FTP | other *** search
- Path: anvil.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: argc/argv & switches
- Date: 6 Mar 1996 14:54:16 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4hl52oINNa4l@anvil.ugrad.cs.ubc.ca>
- References: <4h2j8j$9gn@milo.freenet.vancouver.bc.ca> <danpop.825593142@rscernix> <313E0094.167EB0E7@fore.com>
- NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
-
- In article <313E0094.167EB0E7@fore.com>,
- Jeff Rosenfeld <jeffro@fore.com> wrote:
- >Dan Pop wrote:
- >> Note that *++argv[0] is technically incorrect, because there is no
- >> guarantee that argv[0] can be modified by the program, it can be legally
- >> stored in a read only memory segment.
- >
- >Not so. The standard mandates that if main is defined with two
- >parameters (which we'll call argc and argv), then:
- >
- > The parameters argc and argv and the strings pointed
- > to by the argv array shall be modifiable by the program....
-
- But argv[0] is not the argv parameter, but the first pointer pointed at by
- argv. That the strings are modifiable doesn't necessarily imply that the
- array of pointers through which these strings are accessed is itself
- modifiable.
-
- However, if it were the case that these pointers are not modifiable, would not
- the declaration of main() be required to be written as:
-
- int main(int argc, char * const *argv)
-
- or
-
- int main(int argc, char * const argv[])
-
- That is, ``argv is a pointer to a vector of constant pointers to modifiable
- chars''.
- --
-
-